package yartiss.engine.simulation.system.schedulable;

public class Job {

	private long timeCost;
	private long energyCost;
	private final long jobId;
	private final long activationDate;
	private final long absoluteDeadline;
	/**
	 * A job should only be obtain by method Task.nextJob()
	 */
	public Job(long date, long wcet, long wcee, long absoluteDi) { 
		this.jobId = date;
		timeCost = wcet;
		energyCost = wcee;
		activationDate = date;
		absoluteDeadline = absoluteDi;
	}

	public long getJobId() {
		return jobId;
	}
	
	public long getRomainingTimeCost(){
		return timeCost;
	}
	
	public long getRomainingEnergyCost(){
		return energyCost;
	}
	
	
	public void consumeProcTime(long duration){
		timeCost -= duration;
		assert timeCost >= 0 : "jobId ; "+jobId+" : timeCost < 0";  
	}
	
	
	public void consumeEnergy(long energy){
		energyCost -= energy;
		assert energyCost >= 0 : "jobId ; "+jobId+" : energyCost < 0";  
	}

	/**
	 * @return the activationDate
	 */
	public long getActivationDate() {
		return activationDate;
	}

	/**
	 * @return the absoluteDeadline
	 */
	public long getAbsoluteDeadline() {
		return absoluteDeadline;
	}
	
	
	
}
